<!doctype html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>课程信息系统</title>
  <meta name="description" content="这是一个 index 页面">
  <meta name="keywords" content="index">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <link rel="icon" type="image/png" href="assets/i/favicon.png">
  <link rel="apple-touch-icon-precomposed" href="assets/i/app-icon72x72@2x.png">
  <meta name="apple-mobile-web-app-title" content="Amaze UI" />
  <link rel="stylesheet" href="assets/css/amazeui.min.css" />
  <link rel="stylesheet" href="assets/css/admin.css">
  <link rel="stylesheet" href="app1.css">
</head>

<body data-type="login">

  <div class="am-g myapp-login" >
	<div class="myapp-login-logo-block  tpl-login-max" style="position:relative;margin-top: 5%">
		<div class="tip">用户名或密码错误</div>
		<div class="myapp-login-logo-text">
			<div class="myapp-login-logo-text">
				<span> 登陆</span> <i class="am-icon-skyatlas"></i>
				
			</div>
		</div>

		<div class="login-font">
			<i>Log In </i> 
		</div>
		<div class="am-u-sm-10 login-am-center">
			<form class="am-form">
				<fieldset>
					<div class="am-form-group">
						<input type="text" class="input" id="authorName" name="authorName" placeholder="输入用户名">
					</div>
					<div class="am-form-group">
						<input type="password" class="input" id="authorPwd" name="authorPwd" placeholder="输入密码">
					</div>
					<p><button type="button" class="am-btn am-btn-default" onclick="sub()">登录</button></p>
				</fieldset>
			</form>
		</div>
	</div>
</div>

 
  <script src="assets/js/jquery.min.js"></script>
  <script src="assets/js/amazeui.min.js"></script>
  <script src="assets/js/app.js"></script>
  <script>
  	function sub(){
  		var event={
  			loginName:$("#authorName").val(),
  			loginPwd:$("#authorPwd").val()
  		}
  		//console.log(JSON.stringify(event));
	  	$.ajax({
	        type: "post",
	        contentType: "application/json",
	        url: "/author/login",
	        data: JSON.stringify(event),
	        success: function(data) {
                //$('.tip').show();return;
	             if (data.data == "user") {
	                location.href = "./user/chart.html";           
	            }else if(data.data=="admin"){
	            	location.href = "./admin/index.html"; 
	            }else{
	            	$('.tip').show();
	            }
	        }
	    })
    }
    $(document).on("click",".input",function(){
    	$(".tip").hide();
    })
  </script>
</body>

</html>